var app = getApp();

Page({
  data: {
    baoji_list:{},
    showModal: false,
    dateqf: '出发时间',
    initplace:'出发地',
    targetplace:'目的地',
    targetcityid: '',
    initcityid: '',
  },

  onLoad: function (options) {
    // var initplace = app.globalData.initplace;
    // var targetplace = app.globalData.targetplace;
    // console.log(app.globalData.initplace+'-----init')
    // console.log(app.globalData.targetplace+'-----target')
    //   this.setData({
    //     initplace: initplace,
    //     targetplace: targetplace
    //   })
    
    this.baoji_list();
  },
  onShow: function(){
    var initplace = app.globalData.initplace;
    var targetplace = app.globalData.targetplace;
    var targetcityid = app.globalData.targetcityid;
    var initcityid = app.globalData.initcityid;
    if(initplace != '' || targetplace != ''){
        this.setData({
          initplace: initplace,
          targetplace: targetplace,
          initcityid: initcityid,
          targetcityid: targetcityid
        })
      }
    
  },
  //  2.签发日期
   bindDateChangeqf: function (e) {
    console.log('picker发送选择改变，携带值为', e.detail.value)
    this.setData({
      dateqf: e.detail.value
    })
  },
  // 弹窗 start
  showDialogBtn: function() {
    this.setData({
      showModal: true
    })
  },
  hideModal: function () {
    this.setData({
      showModal: false
    });
  },
  onCancel: function () {
    this.hideModal();
  },
  onConfirm: function () {
    this.hideModal();
  },
  // 弹窗 end
  goinitplace: function (e) {
    var setid = e.currentTarget.dataset.setid;
      wx.navigateTo({
        url: '../citylist/index?setid='+setid
      })
    
  },
  baoji_list:function(){ //拼机列表
    var that = this;
    wx.request({
      url: app.api.kzdsurl + app.interface.baojiji_list,
      method: 'get',
      data: {},
      header: {
        'Content-Type': 'application/x-www-form-urlencoded'
      },
      success: function (res) {
        that.setData({
          baoji_list: res.data.data,

        });
        //endInitData
      },
      fail: function (e) {
        wx.showToast({
          title: '网络异常！',
          duration: 2000
        });
      },
    });
  },

  onShareAppMessage: function () {
    return {
      title: '宠物美容学校',
      path: '/pages/index/index',
      success: function(res) {
        // 分享成功
      },
      fail: function(res) {
        // 分享失败
      }
    }
  }



});